﻿using System;

namespace Phoenix.Frames
{
    /// <summary>
    /// Navigation frame is used to display content (action results)
    /// </summary>
    public class NavigationFrame : PartialView, INavigationFrameControl
    {
        INavigationFrameController navigationFrameController;

        protected override IContentFrameController CreateContentFrameController()
        {
            navigationFrameController = new NavigationFrameController(this);
            return navigationFrameController;
        }

        public bool CanGoBack
        {
            get { return navigationFrameController.CanGoBack; }
        }

        public override void NavigateTo(NavigationRequest navigationRequest)
        {
            navigationFrameController.NavigateTo(navigationRequest);
        }

        public virtual void NavigateBack()
        {
            navigationFrameController.NavigateBack();
        }

        public virtual void NavigateBackTo(string controller, string action)
        {
            NavigateBackTo(null, controller, action);
        }

        public virtual void NavigateBackTo(string assembly, string controller, string action)
        {
            navigationFrameController.NavigateBackTo(assembly, controller, action);
        }

        public IFrameJournal Journal
        {
            get { return navigationFrameController.Journal; }
        }
    }
}